package cn.eli.vue.service.postAsk.impl;

import cn.eli.vue.entity.PostAsk;
import cn.eli.vue.mapper.postAsk.PostAskMapper;
import cn.eli.vue.service.postAsk.PostAskService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author :lzs
 * @Date : 2021年7月16日
 * @Description : 对service层接口的实现
 */

@Service("PostAskService")
public class PostAskServiceImpl implements PostAskService {
    @Autowired
    PostAskMapper postAskMapper;

    /**
     * @author : lzs
     * @Description :业务类接口
     */

    /*发布问题*/
    @Override
    public int AskPost(int user_id, String postAsk_title,String postAsk_discribe, String postAsk_img){
        return postAskMapper.AskPost(user_id,postAsk_title,postAsk_discribe,postAsk_img);
    }
    /*修改问题*/
    @Override
    public int AskModify(int postAsk_id,String postAsk_title,String postAsk_discribe, String postAsk_img){
        return postAskMapper.AskModify(postAsk_id,postAsk_title,postAsk_discribe,postAsk_img);
    }

    /*收藏问题*/
    @Override
    public int AskSubscribeInsert(int user_id,int postAsk_id){
        return postAskMapper.AskSubscribeInsert(user_id,postAsk_id);
    }
    /*收藏问题*/
    @Override
    public int AskSubscribeUpdate(int user_id,int postAsk_id){
        return postAskMapper.AskSubscribeUpdate(user_id,postAsk_id);
    }

    /*取消收藏问题*/
    @Override
    public int AskSubscribeCancelDelete(int user_id,int postAsk_id){
        return postAskMapper.AskSubscribeCancelDelete(user_id,postAsk_id);
    }
    /*取消收藏问题*/
    @Override
    public int AskSubscribeCancelUpdate(int user_id,int postAsk_id){
        return postAskMapper.AskSubscribeCancelUpdate(user_id,postAsk_id);
    }
    /*获取所有问题*/
    @Override
    public List<PostAsk> AllAsk(){
        return postAskMapper.AllAsk();
    }
    /*获取该用户发布的所有问题*/
    @Override
    public List<PostAsk> AllAskInUser(int user_id){
        return postAskMapper.AllAskInUser(user_id);
    }
}
